/*设计一个类表示数学中点的概念，有成员属性，x，y表示该点的二维坐标。
（运算符重载，默认参数）
该类有默认参数的构造方法，x，y的值默认为0
该类重载了运算符‘＋’，能够实现两点相加
该类重载了运算符‘＋＋’，能够实现，x，和y分别自增1
*/
#include <iostream>
using namespace std;

class Point
{
private:
    int x;
    int y;
public:
    Point(int x=0,int y=0)
    :x(x),y(y){}
    ~Point(){}
    Point(const Point&p)
    {
        this->x = p.getX();
        this->y = p.getY();
    }
    void display()
    {
        cout<<"("<<this->x<<","<<this->y<<")"<<endl;
    }
    int getX()const
    {
        return this->x;
    }
    int getY()const
    {
        return this->y;
    }
    Point operator + (const Point&a)
    {
        int c=this->x + a.getX();
        int d=this->y + a.getY();
        return Point(c,d);
    }
    const Point operator ++(int)
    {
        Point tmp = *this;
        this->x ++;
        this->y ++;
        return tmp;
    }
    const Point & operator ++()
    {
        this->x ++;
        this->y ++;
        return *this;
    }
};

int main(int argc,char*argv[])
{
    Point p1(2,3);
    Point p2(5,9);

    Point p3 = p1 + p2;
    p3.display();

    Point p4 = p3++;
    p4.display();
    p3.display();
    
    return 0;
}

